<?php
namespace app\common\validate;
use think\Validate;
class Deal extends Validate {
    protected $rule = [
        ['id','number'],
        ['name','require|max:50','团购名称必须填写'],
        ['image','require','请上传缩略图'],
        ['category_id','require','请选择所属分类'],
        ['city_id','require','请选择所属城市'],
        ['start_time','require','请选择团购开始时间'],
        ['end_time','require','请选择团购结束时间'],
        ['total_count','require','库存数必须填写'],
        ['origin_price','require','原价必须填写'],
        ['current_price','require','团购价必须填写'],
        ['coupons_begin_time','require','请选择消费券生效时间'],
        ['coupons_end_time','require','请选择消费券结束时间'],
        ['notes','require','团购描述必须填写'],
        ['description','require','购买须知必须填写'],
        ['bis_id','number'],
        ['listorder','number'],
        ['status','number|in:-1,0,1,2','状态必须是数字|状态范围不合法'],
    ];

    // 场景设置
    protected  $scene = [
        'add' => ['id', 'name', 'image','bis_id','category_id','city_id','start_time','end_time','total_count','origin_price','current_price','coupons_begin_time','coupons_end_time','notes','description'],
        'listorder'=>['id','listorder'],
        'status' =>['id','status'],
    ];
}